<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    <head>
        <meta charset="UTF-8">
        <title>学生管理添加</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="/static/css/font.css">
        <link rel="stylesheet" href="/static/css/xadmin.css">
        <link rel="stylesheet" href="/static/ztree/css/metroStyle/metroStyle.css">
        <script src="/static/js/jquery.min.js" charset="utf-8"></script>
        <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
        <script src="/static/js/ztree.js" charset="utf-8"></script>
        <script src="/static/js/excheck.js" charset="utf-8"></script>
        <script type="text/javascript" src="/static/js/xadmin.js"></script>
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label for="studentCode" class="layui-form-label">
                            <span class="x-red">*</span> 学生编码
                        </label>
                        <div class="layui-input-inline" >
                            <input type="text" placeholder="规则: HF_姓名拼音" id="studentCode" name="studentCode" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                        <label for="studentName" class="layui-form-label">
                            <span class="x-red">*</span> 学生姓名
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="studentName" name="studentName" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label for="studentParent" class="layui-form-label">
                            <span class="x-red">*</span> 家长姓名
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="studentParent" name="studentParent" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                        <label for="parentPhone" class="layui-form-label">
                            <span class="x-red">*</span> 联系方式
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="parentPhone" name="parentPhone" required="" lay-verify="required|phone"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="grade" class="layui-form-label">
                            <span class="x-red">*</span>当前年级
                        </label>
                        <div class="layui-input-inline">
                            <select id="grade" name="grade">
                                <option value="1">一年级</option>
                                <option value="2">二年级</option>
                                <option value="3">三年级</option>
                                <option value="4">四年级</option>
                                <option value="5">五年级</option>
                                <option value="6">六年级</option>
                                <option value="7">初一</option>
                                <option value="8">初二</option>
                                <option value="9">初三</option>
                                <option value="10">高一</option>
                                <option value="11">高二</option>
                                <option value="12">高三</option>
                            </select>
                        </div>
                        <label for="school" class="layui-form-label">
                            <span class="x-red">*</span>就读学校
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" id="school" name="school" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>

                    </div>


                    <div class="layui-form-item">
                        <label for="extand2" class="layui-form-label">
                            <span class="x-red">*</span>当前住址
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" placeholder="省/市/区/街道/门牌号" style="width: 500px;" id="extand2" name="extand2" required="" lay-verify="required"
                                   autocomplete="off" class="layui-input">
                        </div>
                    </div>


                    <div class="layui-form-item">
                        <button  class="layui-btn" lay-filter="add" lay-submit="" style="margin-left: 111px;">
                            提交
                        </button>
                    </div>
                </form>
            </div>
        </div>
        <script>
            layui.use(['form', 'layer'],
               function() {
                    $ = layui.jquery;
                    var form = layui.form,
                    layer = layui.layer;
                    //监听提交
                    form.on('submit(add)',function(data){
                        $.ajax({
                            url:"/student/user",
                            type:"post",
                            dateType:'json',
                            data:{
                                "studentCode" : data.field.studentCode,
                                "studentName" : data.field.studentName,
                                "studentParent": data.field.studentParent,
                                "parentPhone": data.field.parentPhone,
                                "grade": $("#grade").val(),
                                "school":data.field.school,
                                "extand2":data.field.extand2
                            },
                            success:function(result){
                                if(result.code == 0){
                                    layer.alert("添加成功",{icon:6},function(){
                                        //关闭当前frame
                                        xadmin.close();
                                        // 可以对父窗口进行刷新
                                        xadmin.father_reload();
                                    });
                                }

                            }
                        });
                        return false;
                    });




            });

            layui.use(['laydate','form'], function(){
                var laydate = layui.laydate;
                //执行一个laydate实例
                laydate.render({
                    elem: '#start' //指定元素
                });
            });
        </script>

    </body>

</html>
